/*********************************************************************
 *                                                                   *
 *  Js Css Minifier ( JsCssMin )                                     *
 *  Author: Igor Kanshyn                                             *
 *  Copyright (c) 2009, Igor Kanshyn. All rights reserved.           *
 *                                                                   *
 *  JsCssMin is released under the Apache Software License.          *
 *  See LICENSE.txt for more details.                                *
 *                                                                   *
 *********************************************************************/

package org.grenader.jscssmin;

import org.grenader.jscssmin.files.FileUtils;
import org.junit.After;
import org.junit.Before;

import java.io.File;
import java.io.IOException;

/**
 * <p>Product: JsCssMin ( JavaScript and CSS Minifier )<br>
 * Author: Igor Kanshyn (grenader).
 * </p>
 * Date: Apr 27, 2009
 */
public class TmpDirTestCaseBase {
    protected File tmpOriginalDir;
    protected File tmpDestinatonDir;

    @Before
    public void setUp() throws IOException {
        // prepare File Structure
        String tmpPath = System.getProperty("java.io.tmpdir");
        tmpOriginalDir = new File(tmpPath, System.currentTimeMillis() + "");
        if (!tmpOriginalDir.mkdir())
            org.junit.Assert.fail("Tmp Directory has not been created!");

        tmpDestinatonDir = new File(tmpPath, System.currentTimeMillis() + "_dest");
        if (!tmpDestinatonDir.mkdir())
            org.junit.Assert.fail("Tmp Directory has not been created!");
    }

    @After
    public void tearDown() {
        FileUtils.deleteDirectory(tmpOriginalDir);
        FileUtils.deleteDirectory(tmpDestinatonDir);
    }
}
